package com.blw.demoactiviti.testbean;

import org.activiti.engine.RuntimeService;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: baolw
 * @date 2017/12/7 14:22
 */
public class UserBean {

    /** 由Spring注入 */
    private RuntimeService runtimeService;

    @Transactional
    public void hello() {
        //这里，你可以在你们的领域模型中做一些事物处理。
        //当在调用Activiti RuntimeService的startProcessInstanceByKey方法时，
        //它将会结合到同一个事物中。
        runtimeService.startProcessInstanceByKey("helloProcess");
    }

    public void setRuntimeService(RuntimeService runtimeService) {
        this.runtimeService = runtimeService;
    }
}
